package com.smartcruise.main.mainFragment.messageNotice.messageNoticeDetail;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.smartcruise.R;
import com.smartcruise.base.BaseTitleFragment;
import com.smartcruise.base.TitleBuilder;
import com.smartcruise.data.MessageNotice;
import com.smartcruise.util.IntentUtils;

/**
 * Created by FengChaoQun
 * on 2018/1/21 0021
 * 异常详情
 */

public class ExceptionDetailFragment extends BaseTitleFragment {

    private MessageNotice messageNotice;

    public static ExceptionDetailFragment newInstance(MessageNotice messageNotice) {
        Bundle bundle = new Bundle();
        bundle.putSerializable(IntentUtils.DATA, messageNotice);
        ExceptionDetailFragment signInDetailFragment = new ExceptionDetailFragment();
        signInDetailFragment.setArguments(bundle);
        return signInDetailFragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            messageNotice = (MessageNotice) getArguments().getSerializable(IntentUtils.DATA);
        }
        if (messageNotice == null) {
            showToast(getString(R.string.nothingToShow));
            getActivity().finish();
        }
    }

    @Override
    protected void init() {
        setCloseActivity();
    }

    @Override
    protected int getContentLayout() {
        return R.layout.fragment_container_exception_detail;
    }

    @Override
    protected TitleBuilder getTitleBuilder() {
        return TitleBuilder.create(true, getString(R.string.exceptionNotice));
    }

}
